using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Musicman.Business;


    public partial class Default_master : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.User.Identity.IsAuthenticated)
            {
                Musicman.Common.Entities.User user = UserManager.Instance.GetUser(Int64.Parse(Page.User.Identity.Name));
                UserLbl.Text = String.Format("{0} {1}", user.Firstname, user.Lastname);
                UserLbl.Visible = true;
            }
            else
            {
                UserLbl.Visible = false;
            }
        }

        protected void menu_MenuItemDataBound(object sender, MenuEventArgs e)
        {
            if (e.Item.Text.StartsWith("Wall") && Page.User.Identity.IsAuthenticated )
            {
                int newMsgCount = UserMassageManager.Instance.GetNewMessagesCount(
                    Int64.Parse(Page.User.Identity.Name));
                if (newMsgCount > 0)
                {
                    e.Item.Text = String.Format("Wall ({0} new) ", newMsgCount);
                }
                else
                {
                    e.Item.Text = "Wall";
                }
            }
        }
    }